﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using System.ServiceModel.Web;
using WcfService.DTO;
using WcfService.DAO;

namespace WcfService
{

    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "Service" in code, svc and config file together.
    public class Service : IService
    {
        RssDAO rss = new RssDAO();
        NguoiDungDAO user = new NguoiDungDAO();
        BinhLuanDAO comment = new BinhLuanDAO();
        TinTucDAO news = new TinTucDAO();

        //Rss
        public RssDTO[] getRssAll()
        {
            return rss.getAll();
        }

        public RssDTO[] getRssUser(String ma)
        {
            return rss.getRssUser(ma);
        }


        #region Người dùng
        public NguoiDungDTO[] getUsersAll()
        {
            return user.getAll();
        }

        public NguoiDungDTO[] getUser(string ma)
        {

            return user.getUser(ma);
        }

        public void insertUser(NguoiDungDTO info)
        {
            user.insertUser(info);
        }

        public void delete(string ma)
        {
            user.delete(ma);
        }

        public void deleteUser(string ma, string tinhTrang)
        {
            user.deleteRestore(ma, tinhTrang); 
        }

        public void updateUser(NguoiDungDTO info)
        {
            user.updateUser(info);
        }
        #endregion

        //BinhLuan
        public BinhLuanDTO[] getCommentsAll()
        {

            return comment.getAll();
        }
        public BinhLuanDTO[] getComment(string ma)
        {

            return comment.getComment(ma);
        }

        //TinMuaBan
        public TinTucDTO[] getNewsAll()
        {

            return news.getAll();
        }

        public TinTucDTO[] getNews(string matin)
        {

            return news.getNews(matin);
        }


        public void DoWork()
        {
        }
    }
}
